package io.chenglicun.modules.point.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.chenglicun.common.service.impl.CrudServiceImpl;
import io.chenglicun.common.constant.Constant;
import io.chenglicun.modules.point.dao.PointStandardDetailDao;
import io.chenglicun.modules.point.dto.PointStandardDetailDTO;
import io.chenglicun.modules.point.entity.PointStandardDetailEntity;
import io.chenglicun.modules.point.service.PointStandardDetailService;
import io.chenglicun.modules.security.user.SecurityUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 指标详情
 *
 * @author gr 137664951@qq.com
 * @since 1.0 2023-09-05
 */
@Service
public class PointStandardDetailServiceImpl extends CrudServiceImpl<PointStandardDetailDao, PointStandardDetailEntity, PointStandardDetailDTO> implements PointStandardDetailService {

    @Override
    public QueryWrapper<PointStandardDetailEntity> getWrapper(Map<String, Object> params){
        QueryWrapper<PointStandardDetailEntity> wrapper = new QueryWrapper<>();
        if(params.containsKey("standardId")){
            wrapper.lambda().eq(PointStandardDetailEntity::getStandardId,params.containsKey("standardId"));
        }
        wrapper.orderByDesc("create_date","sort");
        return wrapper;
    }


    @Override
    public List<PointStandardDetailDTO> listPointStandardDetailDTO(Map<String, Object> params) {
        return list(params);
    }

    @Override
    public Integer getMaxSort() {
        return baseDao.getMaxSort()+1;
    }
}
